-- Demonstrate recursive types.

data Tree a = Node a (Tree a) (Tree a)
            | Empty
              deriving (Show)

-- Pre exercise 2.
data TreeUsingMaybe a = TreeUsingMaybe a (Maybe (TreeUsingMaybe a))
    (Maybe (TreeUsingMaybe a))
                        deriving (Show)

-- Exercise 8.
heightOfTree (Node a left right) =
    1 + max (heightOfTree left) (heightOfTree right)
heightOfTree Empty = 0
